package com.bookshop.ui;

import javax.swing.JPanel;

public class InnerPageJumper implements IJumper{
	private final JPanel mBasePanel;
	private JPanel mInnerPage;
	
	public InnerPageJumper(JPanel pBasePanel) {
		mBasePanel = pBasePanel;
		
	}
	
	@Override
	public void loadPage(JPanel pPanel) {
		if (pPanel == mInnerPage|| pPanel == null) return;
		
		if (mInnerPage != null) {
			mBasePanel.remove(mInnerPage);
		}
		mInnerPage = pPanel;
		mBasePanel.add(mInnerPage);
		mBasePanel.validate();
		mBasePanel.repaint();
	}
	
	

}
